<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>雪花</title>
    <style>
        body {
            background: black;
        }
    </style>
</head>

<body>

</body>
<script>
    function Flake() {
        var h = document.documentElement.clientHeight;
        var w = document.documentElement.clientWidth;

        var top = Math.random() * h;
        console.log(top)
        var left = Math.random() * w;
        var snow = document.createElement("img");
        snow.src = "hua.gif";
        snow.style.position = "absolute";

        snow.style.transform = "scale(" + Math.random() / 0.9 + ")";
        document.body.appendChild(snow);

        function snowdown() {
            top = top + Math.random() * 10;
            left = left + Math.random() * 10;
            snow.style.top = top + "px";
            snow.style.left = left + "px";
            if (top > h) {
                top = -100;
            }
            if (left > w) {
                left = -100;
            }
        }
        setInterval(snowdown, 200)
    }
    for (i = 0; i < 100; i++) {
        Flake()
    }
</script>

</html>